Explore Map#
Import Libraries#
External Libraries#
import geopandas as gpd
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import geopandas as gpd
File ~\anaconda3\envs\nyc-street-flooding-analysis\Lib\site-packages\geopandas\__init__.py:1
----> 1 from geopandas._config import options # noqa
3 from geopandas.geoseries import GeoSeries # noqa
4 from geopandas.geodataframe import GeoDataFrame # noqa
File ~\anaconda3\envs\nyc-street-flooding-analysis\Lib\site-packages\geopandas\_config.py:109
102 import geopandas._compat as compat
104 compat.set_use_pygeos(value)
107 use_pygeos = Option(
108 key="use_pygeos",
--> 109 default_value=_default_use_pygeos(),
110 doc=(
111 "Whether to use PyGEOS to speed up spatial operations. The default is True "
112 "if PyGEOS is installed, and follows the USE_PYGEOS environment variable "
113 "if set."
114 ),
115 validator=_validate_bool,
116 callback=_callback_use_pygeos,
117 )
120 options = Options({"display_precision": display_precision, "use_pygeos": use_pygeos})
File ~\anaconda3\envs\nyc-street-flooding-analysis\Lib\site-packages\geopandas\_config.py:95, in _default_use_pygeos()
94 def _default_use_pygeos():
---> 95 import geopandas._compat as compat
97 return compat.USE_PYGEOS
File ~\anaconda3\envs\nyc-street-flooding-analysis\Lib\site-packages\geopandas\_compat.py:9
7 import numpy as np
8 import pandas as pd
----> 9 import pyproj
10 import shapely
11 import shapely.geos
File ~\anaconda3\envs\nyc-street-flooding-analysis\Lib\site-packages\pyproj\__init__.py:33
1 """
2 Python interface to PROJ (https://proj.org),
3 cartographic projections and coordinate transformations library.
(...)
29 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 """
31 import warnings
---> 33 import pyproj.network
34 from pyproj._datadir import ( # noqa: F401 pylint: disable=unused-import
35 _pyproj_global_context_initialize,
36 set_use_global_context,
37 )
38 from pyproj._show_versions import ( # noqa: F401 pylint: disable=unused-import
39 show_versions,
40 )
File ~\anaconda3\envs\nyc-street-flooding-analysis\Lib\site-packages\pyproj\network.py:10
6 from typing import Union
8 import certifi
---> 10 from pyproj._network import ( # noqa: F401 pylint: disable=unused-import
11 _set_ca_bundle_path,
12 is_network_enabled,
13 set_network_enabled,
14 )
17 def set_ca_bundle_path(ca_bundle_path: Union[Path, str, bool, None] = None) -> None:
18 """
19 .. versionadded:: 3.0.0
20
(...)
40 variables.
41 """
ImportError: DLL load failed while importing _network: The specified module could not be found.
External Libraries#
Define Variables#
nyc_street_flooding_input = 'data/street-flooding/clean_street-flood-complaints_rows-all.geojson'
Get Clean Data#
street_flooding_gdf = gpd.read_file(nyc_street_flooding_input)
View Complaints on OpenStreetMap#
street_flooding_gdf['geometry'] = street_flooding_gdf.geometry
popup_columns = [
'geometry',
'created_date',
'incident_address',
'city',
'incident_zip',
'borough',
'bbl',
'status',
]
Convert datetime64 data type to string#
datetime64 needs to be converted to string before viewing using
GeoPandas.explore(), otherwise the following error will appear:
Object of type Timestamp is not JSON serializable
# created_date, resolution_action_updated_date, closed_date
street_flooding_gdf['created_date'] = street_flooding_gdf['created_date'].dt.strftime('%Y-%m-%d %H:%M:%S')
street_flooding_gdf['resolution_action_updated_date'] = street_flooding_gdf['resolution_action_updated_date'].dt.strftime('%Y-%m-%d %H:%M:%S')
street_flooding_gdf['closed_date'] = street_flooding_gdf['closed_date'].dt.strftime('%Y-%m-%d %H:%M:%S')
street_flooding_gdf[popup_columns].explore('borough')
Make this Notebook Trusted to load map: File -> Trust Notebook